home *** CD-ROM | disk | FTP | other *** search
- function childLockSet(val)
- {
- makeChildren(ndParent,true);
- }
- function make(section)
- {
- active = true;
- arrParentIndex = [];
- SECTION_COLOR = Tardis.Colors.getHex(section);
- SECTION_HALF_COLOR = Tardis.Colors.getHex(section + "50");
- mc_title.txt.textColor = SECTION_COLOR;
- mc_up.clr.setRGB(SECTION_HALF_COLOR);
- xmlMenu = new XML();
- xmlMenu.onLoad = build;
- xmlMenu.load(Tardis.ASSETS_FOLDER + "xml/sections/" + section + ".xml");
- }
- function clearUp()
- {
- mc_root.removeMovieClip();
- delete mc_root;
- delete mc_lock;
- delete xmlMenu;
- delete ItemHome;
- delete ndPromo;
- delete mcPromo;
- delete ndParent;
- animating = false;
- hide();
- }
- function hide()
- {
- _visible = false;
- active = false;
- }
- function doOver(nm)
- {
- mc_root["mc_i_" + nm].onRollOver(true);
- }
- function doOut(nm)
- {
- mc_root["mc_i_" + nm].onRollOut(true);
- }
- function doUp(nm)
- {
- mc_root["mc_i_" + nm].onRelease(true);
- }
- function setTitle(str)
- {
- with(mc_title)
- {
- txt.htmlText = str.replace("\\n","<br>");
- txt.textColor = SECTION_COLOR;
- txt.resize();
- }
- }
- function build()
- {
- var ndRoot = xmlMenu.firstChild;
- var ndStyle = ndRoot.byName("style");
- strDefault = ndStyle.attributes["default"];
- strDefaultUp = ndStyle.attributes.up;
- ItemHome = ndRoot.byName("items").firstChild;
- _visible = true;
- makeChildren(ItemHome);
- onReady();
- }
- function clearAll()
- {
- mc_root.removeMovieClip();
- }
- function makeChildren(nd, blnDontLoadPage)
- {
- var fadeItem = function(obj)
- {
- obj._alpha = 0;
- obj.i = (i + 1) * 2;
- if(obj.onEnterFrame != null)
- {
- trace("ERROR");
- }
- obj.onEnterFrame = itemFadeEnterFrame;
- };
- var createItem = function(strName)
- {
- var mc = mc_root.createEmptyMovieClip(strName,++mc_root.depth);
- mc.createTextField("txt",0,0,0,167,10);
- var strLabel = node.attributes.label.toString().replace("\\n","<br>");
- with(mc.txt)
- {
- embedFonts = true;
- selectable = false;
- wordWrap = true;
- html = true;
- autoSize = "left";
- htmlText = "<font face=\"TardisFGDemi\" size=\"" + nmTextSize + "\">" + strLabel + "</font>";
- textColor = SECTION_HALF_COLOR;
- }
- mc.index = i;
- if(i > 0)
- {
- var mc_p = mc_root["mc_i_" + (i - 1)];
- mc._y = mc_p._y + mc_p._height + PADDING;
- }
- fadeItem(mc);
- mc.sound = node.attributes.type != "html" ? "ContentLink" : "WebLink";
- return mc;
- };
- if(nd == Tardis.ActiveItem && nd.attributes.type == "promo")
- {
- nd = Tardis.ActiveItem = ndPromo;
- }
- nmFading = 0;
- objLastClicked = null;
- clearAll();
- if(nd == ItemHome)
- {
- setTitle(strDefault);
- mc_up.hide();
- }
- else
- {
- setTitle(nd.attributes.label);
- mc_up.show();
- }
- ndParent = nd;
- this.createEmptyMovieClip("mc_root",++depth);
- mc_root._x = 8;
- if(nd.attributes.hidenavtitle == "true")
- {
- mc_root._y = 12;
- setTitle("");
- }
- else
- {
- mc_root._y = mc_title._y + mc_title._height + 2;
- }
- nmItems = nd.childNodes.length;
- var nmSpacingForItems = nd.attributes.spacingforitems;
- nmSpacingForItems != null ? 0 : (nmSpacingForItems = nmItems);
- if(nmSpacingForItems > 15)
- {
- padding = -6;
- mc_root._y -= 6;
- }
- else if(nmSpacingForItems > 10)
- {
- padding = -3;
- }
- else
- {
- padding = 0;
- }
- var strPadding = nd.attributes.padding;
- if(strPadding != null)
- {
- padding = parseInt(strPadding);
- }
- var strFontSize = nd.attributes.fontsize;
- var nmTextSize = strFontSize == null ? (nmItems <= 15 ? 12 : 11) : parseInt(strFontSize);
- var nmLeading = -1;
- var strUpText;
- var strParentUpText;
- if(nd.parentNode == ItemHome)
- {
- strUpText = strDefaultUp;
- }
- else
- {
- strParentUpText = nd.parentNode.attributes.up;
- if(strParentUpText != null)
- {
- strUpText = strParentUpText;
- }
- else
- {
- strUpText = nd.parentNode.attributes.label;
- }
- }
- mc_up.txt.text = strUpText;
- var node;
- var strType;
- var mc;
- var i = 0;
- while(i < nmItems)
- {
- node = nd.childNodes[i];
- node.index = i;
- mc = createItem("mc_i_" + i);
- strType = node.attributes.type;
- if(strType == "promo")
- {
- mc.onRollOver = pOver;
- mc.onRollOut = pOut;
- mc.onRelease = rUp;
- mcPromo = mc;
- mc.node = node;
- }
- else if(strType == "semiOverlay")
- {
- trace("-- I\'ve got a semi");
- mc.onRollOver = rOver;
- mc.onRollOut = rOut;
- mc.onRelease = rUp;
- mc.node = node;
- }
- else if(strType == "locallink")
- {
- mc.onRollOver = rOver;
- mc.onRollOut = rOut;
- mc.onRelease = lUp;
- mcPromo = mc;
- mc.node = node;
- }
- else
- {
- mc.onRollOver = rOver;
- mc.onRollOut = rOut;
- mc.onRelease = rUp;
- mc.node = node;
- if(strType == "lock")
- {
- mc_lock = mc;
- }
- }
- if(Tardis.ChildLock.active == true && (node.attributes.type == "html" || node.attributes.type == "promo"))
- {
- mc._y -= mc._height + PADDING;
- mc._visible = false;
- }
- i++;
- }
- _xscale = 100;
- if(nd.attributes.type == null && nd.firstChild.hasChildNodes() != true && blnDontLoadPage != true)
- {
- mc_root.mc_i_0.onRelease(null,true);
- }
- animating = true;
- }
- function rUp(fromContent, blnSilent)
- {
- if(this == objLastClicked)
- {
- return undefined;
- }
- if(blnSilent == null)
- {
- Tardis.SFX.play(this.sound + "Click");
- }
- loadItem(this.node,0,this);
- if(this.node.attributes.type != "inactive" && this.node.childNodes.length > 0)
- {
- arrParentIndex.push(this.index);
- ndNext = this.node;
- objLastClicked = this;
- animating = true;
- fadeDownOthers();
- fadeDownFinished();
- }
- else
- {
- animating = false;
- if(blnSilent == null)
- {
- onComplete();
- }
- }
- }
- function rOver(fromContent)
- {
- if(this != objLastClicked)
- {
- Tardis.SFX.play(this.sound + "Over");
- if(fromContent != true)
- {
- EB.broadcastMessage("doOver",this.index);
- }
- this.txt.textColor = SECTION_COLOR;
- }
- }
- function rOut(fromContent)
- {
- if(this != objLastClicked)
- {
- if(fromContent != true)
- {
- EB.broadcastMessage("doOut",this.index);
- }
- this.txt.textColor = SECTION_HALF_COLOR;
- }
- }
- function itemFadeEnterFrame()
- {
- with(this)
- {
- i--;
- if(i <= 0)
- {
- _alpha += 100;
- if(_alpha >= 100)
- {
- onEnterFrame = null;
- fadeUpFinished();
- }
- }
- }
- }
- function fadeUpFinished()
- {
- nmFading++;
- if(nmFading == nmItems)
- {
- animating = false;
- onComplete();
- }
- }
- function fadeDownOthers()
- {
- nmFading = 0;
- var mc;
- var i = 0;
- while(i < nmItems)
- {
- mc = mc_root["mc_i_" + i];
- if(mc != objLastClicked)
- {
- mc.i = (len - i + 1) * 2;
- if(mc.onEnterFrame != null)
- {
- trace("ERROR!");
- }
- mc.onEnterFrame = itemFadeUpEnterFrame;
- }
- i++;
- }
- }
- function fadeDownFinished()
- {
- nmFading++;
- if(nmFading == nmItems)
- {
- makeChildren(ndNext);
- }
- }
- function itemFadeUpEnterFrame()
- {
- with(this)
- {
- i--;
- if(i <= 0)
- {
- _alpha -= 40;
- if(_alpha <= 0)
- {
- onEnterFrame = null;
- fadeDownFinished();
- }
- }
- }
- }
- function doPromoUp()
- {
- if(typeof mcPromo == "movieclip")
- {
- mcPromo.onRelease(true);
- }
- else
- {
- Tardis.itemGo(ndPromo);
- }
- }
- function doPromoOver()
- {
- mcPromo.onRollOver(true);
- }
- function doPromoOut()
- {
- mcPromo.onRollOut(true);
- }
- function pOver(fromContent)
- {
- if(this != objLastClicked)
- {
- Tardis.SFX.play(this.sound + "Over");
- if(fromContent != true)
- {
- EB.broadcastMessage("doPromoOver");
- }
- this.txt.textColor = SECTION_COLOR;
- }
- }
- function pOut(fromContent)
- {
- if(this != objLastClicked)
- {
- if(fromContent != true)
- {
- EB.broadcastMessage("doPromoOut");
- }
- this.txt.textColor = SECTION_HALF_COLOR;
- }
- }
- function doAdvertUp(ndAdvert)
- {
- if(typeof mcAdvert == "movieclip")
- {
- mcAdvert.onRelease(true);
- }
- else
- {
- var obj = new Object();
- obj.filename = ndAdvert.attributes.filename;
- obj.strType = ndAdvert.attributes.category;
- obj.disableLevel = ndAdvert.attributes.disableLevel;
- obj.trackingID = ndAdvert.attributes.trackingID;
- obj.header = "default";
- obj.closeBut = "advert";
- Tardis.OverlayController.addOverlay(obj);
- }
- }
- function doAdvertOver()
- {
- mcPromo.onRollOver(true);
- }
- function doAdvertOut()
- {
- mcPromo.onRollOut(true);
- }
- function lUp()
- {
- if(blnSilent == null)
- {
- Tardis.SFX.play(this.sound + "Click");
- }
- loadItem(this.node,0,this);
- var file = this.node.attributes.file;
- getURL("Lingo:Flsh_openLocalLink(\"" + (Tardis.ASSETS_FOLDER + file) + "\")","");
- animating = false;
- if(blnSilent == null)
- {
- onComplete();
- }
- }
- hide();
- stop();
- o = ASBroadcaster;
- o._broadcastMessage = function()
- {
- var a = this._listeners.concat();
- var e = arguments.shift();
- for(var i in a)
- {
- a[i][e].apply(a[i],arguments);
- }
- };
- o.addListener = function(obj)
- {
- var a = this._listeners;
- var i = a.length;
- a[-1] = obj;
- while(a[--i] != obj)
- {
- }
- delete a[-1];
- if(i < 0)
- {
- a.unshift(obj);
- this.broadcastMessage = ASBroadcaster._broadcastMessage;
- return true;
- }
- return false;
- };
- o.removeListener = function(obj)
- {
- var a = this._listeners;
- var i = a.length;
- a[-1] = obj;
- while(a[--i] != obj)
- {
- }
- delete a[-1];
- if(i >= 0)
- {
- a.splice(i,1);
- if(a.length == 0)
- {
- this.broadcastMessage = undefined;
- }
- return true;
- }
- return false;
- };
- o.initialize = function(obj)
- {
- obj.broadcastMessage = undefined;
- obj.addListener = AsBroadcaster.addListener;
- obj.removeListener = AsBroadcaster.removeListener;
- obj._listeners = [];
- AsSetPropFlags(obj,"broadcastMessage,addListener,removeListener,_listeners",131);
- };
- ASSetPropFlags(o,null,131);
- delete o;
- EB = {};
- ASBroadcaster.initialize(EB);
- active = false;
- animating = false;
- Tardis.ChildLock.EB.addListener(this);
- DEFAULT_COLOR = 12235927;
- with(mc_title.txt)
- {
- autoSize = "left";
- wordWrap = true;
- }
- mc_up.clr = new Color(mc_up);
- mc_up.onRollOver = function()
- {
- Tardis.SFX.play("NavOver");
- this.clr.setRGB(SECTION_COLOR);
- };
- mc_up.onRollOut = function()
- {
- this.clr.setRGB(SECTION_HALF_COLOR);
- };
- mc_up.onRelease = function()
- {
- if(animating == true)
- {
- return undefined;
- }
- Tardis.SFX.play("NavClick");
- clearAll();
- var ndUp = ndParent.parentNode;
- trace("ndUp:" + ndUp);
- Tardis.itemGo(ndUp);
- makeChildren(ndUp);
- arrParentIndex.pop();
- };
- mc_up.show = function()
- {
- this._visible = true;
- };
- mc_up.hide = function()
- {
- this._visible = false;
- };
- mc_up.hide();
- loadItem = function(node, calledFromCredits, mcItem)
- {
- if(node.attributes.type == "locallink")
- {
- Tardis.localItemGo();
- }
- else
- {
- if(Tardis.itemGo(node) == true)
- {
- mcItem.txt.textColor = SECTION_COLOR;
- objLastClicked.txt.textColor = SECTION_HALF_COLOR;
- objLastClicked = mcItem;
- }
- if(calledFromCredits == 1)
- {
- animating = false;
- onComplete();
- }
- }
- };
- var nmFading = 0;
- var mcPromo;
- var mcAdvert;
-